package org.dut.community.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dut.community.entity.DiscussPost;

import java.util.Date;
import java.util.List;

@Mapper
public interface DiscussPostMapper {
    List<DiscussPost> selectDiscussPosts(int userId,int offset,int limit,int orderMode);

    int selectDiscussPostRows(@Param("userId") int userId);

    int insertDiscussPost(DiscussPost post);

    void updateDiscussPost(int id, String title, String content, Date time);

    DiscussPost selectDiscussPostById(int id);

    int updateCommentCount(int id, int commentCount);

    int updateReadCount(int id, int readCount);

    List<DiscussPost> selectAllDiscussPosts();

    int selectPostReadCount(int postId);

    int updateType(int id, int type);

    int updateStatus(int id, int status);

    List<DiscussPost> selectDeletedDiscussPosts(int userId);

    void updateScore(int postId, double score);

    // 关注者的帖子
    List<DiscussPost> selectFolloweePosts(List<Integer> ids, int offset, int limit);
    // 某人所有的帖子，不分页
    List<DiscussPost> selectUserPosts(int userId);

}
